import java.util.ArrayList;
import java.util.List;

public class CompositeTaxiCharge implements TaxiCharge{
    private List<TaxiCharge> taxiCharges = new ArrayList<TaxiCharge>();

    @Override
    public double chargeFor(int distance) {
        double price = 0;
        for (TaxiCharge taxiCharge : taxiCharges) {
            price += taxiCharge.chargeFor(distance);
        }
        return price;
    }

    public void addTaxiCharge(TaxiCharge taxiCharge) {
        taxiCharges.add(taxiCharge);
    }
}
